package com.urfresh.sp.flume.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * 封装了返回信息的对象
 *
 * @author urfresh.mark
 */
@ApiModel
public class Res {
    //
    @ApiModelProperty(value = "返回代码，0为成功，小于0表示是失败")
    String ret;

    // 失败时描述
    @ApiModelProperty(value = "失败时描述")
    String msg;

    public static Res build(String ret, String msg) {
        Res r = new Res();
        r.setMsg(msg);
        r.setRet(ret);
        return r;
    }

    public static Res build(String ret2) {
        Res r = new Res();
        r.setRet(ret2);
        if(ret2.equals("-1"))
            r.setMsg("签名错误");
        return r;
    }

    /**
     * 返回代码，0为成功，小于0表示是失败
     */
    public String getRet() {
        return ret;
    }

    public void setRet(String ret) {
        this.ret = ret;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

}
